package com.devilvan.betrice.europeacademy.po;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.devilvan.betrice.common.BasePo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import lombok.ToString;
import lombok.experimental.Accessors;
import org.hibernate.annotations.DynamicInsert;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;

import javax.persistence.*;
import java.io.Serial;
import java.io.Serializable;
import java.util.List;

/**
 * @author Evad.Wu
 * @Description 欧洲学术成员 基本信息 映射
 * @date 2022-09-05
 */
@Setter
@Getter
@ToString
@NoArgsConstructor
@Accessors(chain = true)
@TableName(value = "EUROPE_ACADEMY_HEADER")

@Entity
@Table(name = "EUROPE_ACADEMY_HEADER")
@DynamicInsert
@EntityListeners(AuditingEntityListener.class)
@Schema(description = "欧洲学术成员 基本信息 映射")
public class EuropeAcademyHeaderPo extends BasePo implements Serializable {
    @Serial
    private static final long serialVersionUID = -2185559583478382800L;

    @Schema(description = "成员ID")
    @TableField(value = "MEMBERSHIP_ID")
    @Column(name = "MEMBERSHIP_ID", columnDefinition = "BIGINT(20) UNIQUE NOT NULL COMMENT '成员ID'")
    private Long membershipId;
    @Schema(description = "成员头像")
    @TableField(value = "AVATAR")
    @Column(name = "AVATAR", columnDefinition = "VARCHAR(256) COMMENT '成员头像'")
    private String avatar;
    @Schema(description = "成员名称")
    @TableField(value = "NAME")
    @Column(name = "NAME", columnDefinition = "VARCHAR(256) NOT NULL COMMENT '成员名称'")
    private String name;
    @Schema(description = "成员类型")
    @TableField(value = "MEMBER_TYPE")
    @Column(name = "MEMBER_TYPE", columnDefinition = "VARCHAR(64) COMMENT '成员类型'")
    private String memberType;
    @Schema(description = "所属部门")
    @TableField(value = "SECTION")
    @Column(name = "SECTION", columnDefinition = "VARCHAR(64) COMMENT '所属部门'")
    private String section;
    @Schema(description = "次级部门")
    @TableField(value = "AFFILIATED_SECTION")
    @Column(name = "AFFILIATED_SECTION", columnDefinition = "VARCHAR(64) COMMENT '次级部门'")
    private String affiliatedSection;
    @Schema(description = "选举时间")
    @TableField(value = "ELECTED")
    @Column(name = "ELECTED", columnDefinition = "VARCHAR(16) COMMENT '选举时间'")
    private String elected;
    @Schema(description = "主要居住地")
    @TableField(value = "MAIN_RESIDENCE")
    @Column(name = "MAIN_RESIDENCE", columnDefinition = "VARCHAR(128) COMMENT '主要居住地'")
    private String mainResidence;
    @Schema(description = "主页地址")
    @TableField(value = "HOME_PAGE")
    @Column(name = "HOME_PAGE", columnDefinition = "TEXT COMMENT '主页地址'")
    private String homePage;
    @Schema(description = "开放研究者与贡献者身份识别码")
    @TableField(value = "ORC_ID")
    @Column(name = "ORC_ID", columnDefinition = "VARCHAR(64)  COMMENT '开放研究者与贡献者身份识别码'")
    private String orcId;
    @Schema(description = "履历描述")
    @TableField(exist = false)
    @OneToMany(targetEntity = EuropeAcademyResumePo.class, mappedBy = "europeAcademyHeaderPo", cascade = CascadeType.ALL,fetch = FetchType.LAZY)
    private List<EuropeAcademyResumePo> resumePoList;
    @Schema(description = "研究领域")
    @TableField(exist = false)
    @OneToMany(targetEntity = EuropeAcademyScholarshipPo.class, mappedBy = "europeAcademyHeaderPo", cascade = CascadeType.ALL,fetch = FetchType.LAZY)
    private List<EuropeAcademyScholarshipPo> scholarshipPoList;
    @Schema(description = "奖项荣誉")
    @TableField(exist = false)
    @OneToMany(targetEntity = EuropeAcademyAwardPo.class, mappedBy = "europeAcademyHeaderPo", cascade = CascadeType.ALL,fetch = FetchType.LAZY)
    private List<EuropeAcademyAwardPo> awardPoList;
}
